package com.icinfo.cloud.provider.punish.config.enums;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

/**
 * 描述：简案快办模板类型枚举
 * @author shishengyao
 * @description
 * @date 2023/9/5
 */
@AllArgsConstructor
@NoArgsConstructor
public enum FastCaseMattersTemplateTypeEnum {
    /**
     * 已配置文书模板
     */
    T00("DK2XWBL","调查询问笔录",0,0),
    T01("DK2KYBL","现场勘验笔录",1,1),
    T02("DK2XCKYT","现场勘验图",2,2),
    T08("DK2SFZM","现场检查模板",7,3),
    T03("DK2XCZP","现场照片",3,4),
    T04("DK2QTWS","其他",4,5),
    T05("SDDZQRS","送达地址确认书",5,6),
    T06("ZLGZTZS","责令改正通知书",6,7),
    T07("DK2SFZM","身份证明",7,8);


    private String code;
    private String name;
    private int editSort;
    private int sort;

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
    public int getEditSort() {
        return editSort;
    }

    public int getSort() {
        return sort;
    }

    /**
     * 根据类型返回name
     *
     * @param code 类型
     */
    public static String getNameByCode(String code) {
        for (FastCaseMattersTemplateTypeEnum item : FastCaseMattersTemplateTypeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return null;
    }
    /**
     * 根据类型返回name
     *
     * @param code 类型
     */
    public static int getSortByCode(String code) {
        if (null==code){
            return 99;
        }
        for (FastCaseMattersTemplateTypeEnum item : FastCaseMattersTemplateTypeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getSort();
            }
        }
        return 99;
    }
    /**
     * 通过code取枚举
     *
     * @param code
     * @return
     */
    public static FastCaseMattersTemplateTypeEnum getTypeByCode(String code) {
        if (null == code) {
            return null;
        }
        for (FastCaseMattersTemplateTypeEnum enums : FastCaseMattersTemplateTypeEnum.values()) {
            if (enums.getCode().equals(code)) {
                return enums;
            }
        }
        return null;
    }
}
